package com.origin.onlinesys.web.controllers.modules.interviewsys;

import com.origin.onlinesys.common.controllers.BaseController;
import com.origin.onlinesys.domain.modules.interviewsys.Department;
import com.origin.onlinesys.service.modules.interviewsys.impl.DepartmentServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by Administrator on 2015/2/10 0010.
 */
@RequestMapping(value = "/management/dept")
@Controller
public class DepartmentController extends BaseController {

    @Autowired
    DepartmentServiceImpl service;

    @RequestMapping(value = "/findByStateY")
    public @ResponseBody
    List<Department> findByStateY(){
        return service.selectByState("1");
    }

    @RequestMapping(value = "/add")
    public @ResponseBody
    Department addDept(@ModelAttribute Department dept){
        return service.insertDept(dept);
    }

    @RequestMapping(value = "/del")
    public @ResponseBody
    String deleteDept(String id){
        service.deleteDept(id);
        return "1";
    }
}
